<?php if (!defined('THINK_PATH')) exit();?>
<!-- <div class="row"><h3 class="page-header">申请管理<small><?php if(($info["id"]) > "0"): ?>/修改<?php else: ?>/添加<?php endif; ?>申请</small></h3></div> -->
<link href="//cdn.bootcss.com/bootstrap-validator/0.5.3/css/bootstrapValidator.min.css" rel="stylesheet">
<script src="//cdn.bootcss.com/bootstrap-validator/0.5.3/js/bootstrapValidator.min.js"></script>
<div class="row">
        <div class="top">首页>审批申请</div>
        <form id="registerForm" method="post" action="<?php echo U('Apply/editBase');?>" enctype="multipart/form-data" class="form-horizontal">
        <div class="content addapply">
            <div class="box larg-box">
                <h1>新增录入<span>(标*为必填项)</span></h1>
                <div class="list-block">
                    <div class="row form-group" >
                        <input id="status" type="hidden" name="check_status">
                        <input id="user_id" type="hidden" name="user_id" value=<?php echo ($userInfo["id"]); ?>>
                        <label>姓名: <i class="required">*</i></label>
                        <input class="myCss col-sm-2" type="text" name="user_name" id="user_name" value=<?php echo ($userInfo["user_name"]); ?>>
                        <label>身份证号: <i class="required">*</i></label>
                        <input id="identity_no" style="width: 200px;" class="myCss col-sm-2" type="text" name="identity_no" value=<?php echo ($userInfo["identity_no"]); ?>>
                    </div>

                    <div class="row form-group">
                        <label>业务类型: <i class="required">*</i></label>
                        <select name="business_type">
                            <?php if(is_array($businessTypes)): foreach($businessTypes as $key=>$val): if($key == $carInfo['business_type']): ?><option value=<?php echo ($key); ?> selected><?php echo ($val); ?></option>
                                    <?php else: ?>
                                    <option value=<?php echo ($key); ?>><?php echo ($val); ?></option><?php endif; endforeach; endif; ?>
                        </select>
                        <label>车辆性质：<i class="required">*</i> </label>
                        <select name="models_form">
                            <?php if(is_array($carModelItems)): foreach($carModelItems as $key=>$val): if($key == $carInfo['models_form']): ?><option value=<?php echo ($key); ?> selected><?php echo ($val); ?></option>
                                    <?php else: ?>
                                    <option value=<?php echo ($key); ?>><?php echo ($val); ?></option><?php endif; endforeach; endif; ?>
                        </select>
                        <label>上牌类型：<i class="required">*</i> </label>
                        <select name="license_type">
                            <?php if(is_array($onCardItems)): foreach($onCardItems as $key=>$val): if($key == $carInfo['license_type']): ?><option value=<?php echo ($key); ?> selected><?php echo ($val); ?></option>
                                    <?php else: ?>
                                    <option value=<?php echo ($key); ?>><?php echo ($val); ?></option><?php endif; endforeach; endif; ?>
                        </select>
                    </div>
                    <div class="row form-group">
                        <label>贷款银行: <i class="required">*</i></label>
                        <select name="loan_bank_id" style="width: 300px;">
                            <?php if(is_array($bankList)): foreach($bankList as $key=>$ss): if($ss['id'] == $userInfo['loan_bank_id']): ?><option value=<?php echo ($ss["id"]); ?> selected><?php echo ($ss["bank_name"]); ?></option>
                                    <?php else: ?>
                                    <option value=<?php echo ($ss["id"]); ?>><?php echo ($ss["bank_name"]); ?></option><?php endif; endforeach; endif; ?>
                        </select>
                        <label>主贷人手机号: <i class="required">*</i></label>
                        <input id="telephone" class="myCss" type="text" name="telephone" value="<?php echo ($userInfo["telephone"]); ?>">
                    </div>
                    <div class="row">
                        <label>上传照片: <i class="required">*</i></label>
                        <label class="inputfile" for="">
                            <input class="upload" name="identity_photo_pros" accept="image/*" type="file" style="display: none"/><i>身份证正面</i>
                            <img class="pic" src="<?php echo ($userInfo["identity_photo_pros"]); ?>" >
                        </label>
                        <label class="inputfile" for="">
                            <input class="upload" name="identity_photo_cons" accept="image/*" type="file" style="display: none"/><i>身份证反面</i>
                            <img class="pic" src="<?php echo ($userInfo["identity_photo_cons"]); ?>" >
                        </label>
                        <label class="inputfile" for="">
                            <input class="upload" name="credit_authorize_photo" accept="image/*" type="file" style="display: none"/><i>提交征信授权书</i>
                            <img class="pic" src="<?php echo ($userInfo["credit_authorize_photo"]); ?>" >
                        </label>
                        <label class="inputfile" for="">
                            <input class="upload" name="credit_authorize_up" accept="image/*" type="file" style="display: none"/><i>征信授权书抬头照</i>
                            <img class="pic" src="<?php echo ($userInfo["credit_authorize_up"]); ?>" >
                        </label>
                        <!--<label class="inputfile" for="">-->
                            <!--<input class="upload" name="credit_authorize_down" accept="image/*" type="file" style="display: none"/><i>征信授权书低头照</i>-->
                            <!--<img class="pic" src="<?php echo ($userInfo["credit_authorize_down"]); ?>" >-->
                        <!--</label>-->
                        <label class="inputfile" for="">
                            <input class="upload" name="table_credit_photo" accept="image/*" type="file" style="display: none"/><i>征信表格照片</i>
                            <img class="pic" src="<?php echo ($userInfo["table_credit_photo"]); ?>" >
                        </label>
                    </div>
                    <div class="row">
                        <label>配偶姓名: <i class="required">*</i></label>
                        <input type="text" name="spouse_name" class="myCss col-sm-2" value="<?php echo ($userInfo["spouse_name"]); ?>">
                        <label>身份证号: <i class="required">*</i></label>
                        <input type="text" name="spouse_identity_no" style="width: 200px;" class="myCss col-sm-2" value="<?php echo ($userInfo["spouse_identity_no"]); ?>">
                    </div>
                    <div class="row">
                        <label>上传照片: <i class="required">*</i></label>
                        <label class="inputfile" for="">
                            <input class="upload" name="spouse_id_photo_pros" accept="image/*" type="file" style="display: none"/><i>身份证正面</i>
                            <img class="pic" src="<?php echo ($userInfo["spouse_id_photo_pros"]); ?>" >
                        </label>
                        <label class="inputfile" for="">
                            <input class="upload" name="spouse_id_photo_cons" accept="image/*" type="file" style="display: none"/><i>身份证反面</i>
                            <img class="pic" src="<?php echo ($userInfo["spouse_id_photo_cons"]); ?>" >
                        </label>
                        <label class="inputfile" for="">
                            <input class="upload" name="spouse_credit_photo" accept="image/*" type="file" style="display: none"/><i>提交征信授权书</i>
                            <img class="pic" src="<?php echo ($userInfo["spouse_credit_photo"]); ?>" >
                        </label>
                        <label class="inputfile" for="">
                            <input class="upload" name="spouse_credit_up" accept="image/*" type="file" style="display: none"/><i>征信授权书抬头照</i>
                            <img class="pic" src="<?php echo ($userInfo["spouse_credit_up"]); ?>" >
                        </label>
                        <!--<label class="inputfile" for="">-->
                            <!--<input class="upload" name="spouse_credit_down" accept="image/*" type="file" style="display: none"/><i>征信授权书低头照</i>-->
                            <!--<img class="pic" src="<?php echo ($userInfo["spouse_credit_down"]); ?>" >-->
                        <!--</label>-->
                        <!-- <label class="inputfile" for=""><input type="file" name="spouse_id_photo_pros"><i>身份证正面</i></label>
                        <label class="inputfile" for=""><input type="file" name="spouse_id_photo_cons"><i>身份证反面</i></label>
                        <label class="inputfile" for=""><input type="file" name=""><i>提交征信授权书</i></label>
                        <label class="inputfile" for=""><input type="file" name=""><i class="add">+</i></label> -->
                    </div>
                </div>
            </div>
            <div class="box">
                <h1>操作</h1>
                <div class="list-block">
                    <input id="sub-frm" type="button" class="button01" value="提交" name="">
                    <input id="non-sub" type="button" class="button01" value="保存不提交" name="">
                </div>
            </div>
        </div>
        </form>
    </div>


<style type="text/css">
    i{cursor: pointer;}
   .pic{
        width:142px;
        height:120px;
        border-radius:0% ;
        cursor: pointer;
        background: #fff;
        /*position: absolute;
        */z-index: 1;
        }
</style>

<script type="text/javascript">
    $('#non-sub').click(function(){
        $('#status').val(-5);
        $('#registerForm').submit();
    });

    $('#sub-frm').click(function(){
        $('#status').val(-4);
        $('#registerForm').submit();
    });

    $(function() {
        $("i").click(function (elm) {

        $(this).siblings('.upload').click();//隐藏了input:file样式后，点击头像就可以本地上传
        $(this).siblings('.upload').on("change",function(){
            var objUrl = getObjectURL(this.files[0]) ; //获取图片的路径，该路径不是图片在本地的路径
            if (objUrl) {
            $(this).siblings('.pic').attr("src", objUrl) ; //将图片路径存入src中，显示出图片
            }
            });
        });
    });
     
    //建立一個可存取到該file的url
    function getObjectURL(file) {
        var url = null ;
        if (window.createObjectURL!=undefined) { // basic
        url = window.createObjectURL(file) ;
        } else if (window.URL!=undefined) { // mozilla(firefox)
        url = window.URL.createObjectURL(file) ;
        } else if (window.webkitURL!=undefined) { // webkit or chrome
        url = window.webkitURL.createObjectURL(file) ;
        }
        return url ;
    }
</script>
<!-- 上传插件 -->
<script src="/Public/Admin/js/imgUp.js"></script>